package com.jorigin.system.controller;

import com.jorigin.system.po.PagePerson;
import com.jorigin.system.po.Person;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping(value="/user")
public class UserController {

	@RequestMapping("/info")
	public String userInfo(HttpServletRequest request ,Model model)
			throws Exception {

		return "modules/sys/userList";
	}

	@ResponseBody
	@RequestMapping("/userList" )
	public Object getUsers(HttpServletRequest request){
		System.out.println("-----------------获取用户列表--------------------");

		PagePerson pp =  new PagePerson();
		pp.setCode("0");
		pp.setMsg("");
		pp.setCount("3000000");

		Person p1 = new Person();
		p1.setId("10001");
		p1.setUsername("杜甫");
		p1.setCity("浙江杭州");
		p1.setEmail("xianxin@layui.com");
		p1.setExperience("116");
		p1.setIp("192.168.0.8");
		p1.setJoinTime("2016-10-14");
		p1.setLAY_CHECKED("true");
		p1.setLogins("108");
		p1.setSex("男");
		p1.setSign("人生恰似一场修行");
		Person p2 = new Person();
		p2.setId("10001");
		p2.setUsername("杜甫");
		p2.setCity("浙江杭州");
		p2.setEmail("xianxin@layui.com");
		p2.setExperience("116");
		p2.setIp("192.168.0.8");
		p2.setJoinTime("2016-10-14");
		p2.setLAY_CHECKED("true");
		p2.setLogins("108");
		p2.setSex("男");
		p2.setSign("人生恰似一场修行");

		List<Person> data = new ArrayList();
		data.add(p1);
		data.add(p2);
		pp.setData(data);

		return pp;
	}

}
